<?php

namespace App\System\Database\Migrations;

use Hyperf\Database\Migrations\Migration;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Schema;

class CreateTenantMenuTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        //isPageMenu

        Schema::create('hei_tenant_menu', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('租户与菜单关联表');
            $table->addColumn('bigInteger', 'tenant_id', ['unsigned' => true, 'comment' => '租户主键']);
            $table->addColumn('bigInteger', 'menu_id', ['unsigned' => true, 'comment' => '菜单主键']);
            $table->primary(['tenant_id', 'menu_id']);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('hei_tenant_menu');
    }
}